package com.ruiysoft.sms.service.impl;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.ruiysoft.controller.wx.WeChatApiController;
import com.ruiysoft.sms.entity.SmsResult;
import com.ruiysoft.sms.service.SmsService;
import com.ruiysoft.sms.util.AliyunSdk;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

@Service
public class SmsserviceImpl implements SmsService {
    private static final Logger log = LoggerFactory.getLogger(SmsserviceImpl.class);
    @Override
    public Mono<SmsResult> sendVerifyCode(String paramString) {
        return null;
    }

    @Override
    public CommonResponse sendPlaceAnOrder(String phoneNumber, String vCode) {
        CommonRequest re= AliyunSdk.assembleRequest(MethodType.POST,"SendSms","SMS_174585448","禾泽果业",phoneNumber,vCode);
        IAcsClient client=AliyunSdk.getInstance();
        CommonResponse response=null;
        try {
            response=client.getCommonResponse(re);
            log.info("短信发送返回结果:"+response.getData());
//            System.out.println(response.getData());
        } catch (ClientException e) {
            e.printStackTrace();
        }
        return response;
    }

    @Override
    public Mono<SmsResult> checkVerifyCode(String paramString1, String paramString2) {
        return null;
    }
}
